<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
    * {
            margin: 0;
            padding: 0;
        }

        a {
            text-decoration: none;
        }

        ul li {
            list-style: none;
        }

        #shouye {
            width: 100%;
            min-width: 1200px;

        }

        #head {
            width: 80%;
            height: 80px;
            background-color: white;
            margin: 0 auto;
            /* background-color: yellow; */
        }

        #logo {
            /* background-color: red; */
            width: 30%;
            height: 80px;
            float: left;
            position: relative;
            left: 10px;
        }

        #headleft {
            width: 50%;
            float: left;
            height: 80px;
            /* background-color: yellow; */
        }

        #headleft1 {
            height: 80px;
            line-height: 80px;
        }

        #textword {
            width: 250px;
            height: 30px;
        }

        #textsearch {
            width: 50px;
            height: 35px;
            border: 1px solid #ccc;
            background: url(images/serach.jpg);
        }

        /*背景图  */
        #login {
            text-decoration: none;
            color: #407434;
        }

        #login img {
            width: 20px;
            height: 80px;
        }

        #headright {
            height: 80px;
            line-height: 80px;
            text-align: center;
        }

        /* 注销按钮 */
        #loginName,
        #unregister {
            display: none;
        }

        #unregister {
            height: 25px;
            width: 50px;
            border: none;
            outline: none;
            border-radius: 5px;
            background: linear-gradient(rgb(160, 191, 124), rgb(101, 147, 74));
            box-shadow: 0 0 3px rgb(64, 116, 52);
            cursor: pointer;
            color: white;
        }

        #bodynav {
            width: 100%;
            height: 60px;
            background-color: rgb(160, 190, 117);
            /* background-color: red; */
        }

        #nav {
            width: 80%;
            height: 60px;
            margin: 0 auto;
            background-color: rgb(160, 190, 117);
            /* background-color:pink; */
        }

        #nav li {
            height: 60px;
            line-height: 60px;
            text-align: center;
            font-size: 20px;
            width: 20%;
            float: left;
        }

        #nav a {
            color: grey;
            font-weight: bold;
        }

        #nav a:hover {
            color: #407434;
            font-weight: bold;
        }

        /* 套餐 */
      
        #choose {
            width: 500px;
            display: none;
        }
        #pep {
            list-style: none;
            margin-left: 80px;
        }
        #pep dd {
            width: 100px;
            height: 50px;
            line-height: 50px;
            background-color: rgba(251, 251, 251, 0.6);
            font-size: 14px; 
            position: relative;
        }

        #pep dd a {
            color: grey;
        }
        #updown {
            display: none;
            width: 500px;
            height: 200px;
            background-color: #ccc;
            position: fixed;
            z-index: 10px;
        }
        #down:hover #updown {
            display: block;
        }
        #updown li a:first-child {
            font-size: 20px;
            color: #aaa;
        }
        #updown li a:hover {
            color: green;
        }

    </style>
    <script src="js/jquery-3.4.1.min.js"></script>
    <script>
      $(function () {
            $('#secondnav').mouseover(function () {
                $('#choose').css('display', 'block')
            })
            $('#secondnav').mouseout(function () {
                $('#choose').css('display', 'none')
            })
        })
        //登录后显示当前用户
        window.onload = function () {
            if (localStorage.getItem('loginName')) {
                var links = document.querySelectorAll('#headright a')
                for (var i = 0; i < links.length; i++) {
                    links[i].style.display = 'none';
                }
                document.querySelector("#loginName").style.display = 'inline-block';
                document.querySelector("#unregister").style.display = 'inline-block';
                document.querySelector('#headright span').style.display = "none";
                document.querySelector('#loginName').innerHTML="当前账号："+'<a href="personal.html">'+localStorage.getItem('loginName')+'</a>'
            }
        }
        //注销事件
        function unregister() {
            localStorage.removeItem('loginName');
            location.replace('shouye.html')
        }
        //导航栏固定
        window.onscroll = function () {
            if (document.documentElement.scrollTop >= 80) {
                document.getElementById('bodynav').style.position = 'fixed';
                document.getElementById('bodynav').style.top = 0;
                document.getElementById('bodynav').style.left = 0;
            }
            else {
                document.getElementById('bodynav').style.position = 'static';
            }
        }
    </script>
</head>
<body>
   
    <div id="head">
            <div id="logo">
                <img src="images/logo1.jpg" alt="" width="200px" height="80px">
            </div>
            <div id="headleft">
                <div id="headleft1">
                    <form action="#">
                        <input id="textword" type="text"><input id="textsearch" type="submit" value=" ">
                    </form>
                </div>
            </div>
            <div id="headright">
                <a href="login.html" id="login">注册</a>
                <span>|</span>
                <a href="register.html" id="login">登录</a>
                <span id="loginName"></span>
                <button id="unregister" onclick="unregister()">注销</button>
            </div>
        </div>
        <div id="bodynav">
            <div id="nav">
                <ul>
                    <li><a href="shouye.html">首页</a></li>
                    <li id="secondnav"><a href="#">套餐</a>
                        <div id="choose">
                            <dl id="pep">
                                <dd>人数</dd>
                                <dd><a href="meetmenu2-3.html">2-3人</a></dd>
                                <dd><a href="#">4-6人</a></dd>
                                <dd><a href="#">7-8人</a></dd>
                            </dl>
                        </div>
                    </li>
                    <li id="down"><a href="#">健康饮食 </a>
                        <ul id="updown">
                            <li>人体群众</li>
                            <li><a href="laoren.html">老人</a></li>
                            <li><a href="">孕妇</a></li>
                            <li><a href="">青少年</a></li>
                        </ul>
                    </li>
                    <li><a href="fenxiangjiemian.html">分享圈</a></li>
                    <li><a href="#">联系我们</a></li>
                </ul>
            </div>
            <div>
                <ul>
                    <li></li>
                </ul>
            </div>
        </div>
       
</body>
</html>